/*
 * 删除商品分类属性
 */
function delAtt(){
	var del_aid = document.getElementsByName('txtAid');
	var array_aid = new Array();
	for(i=0;i<del_aid.length;i++){
		if(del_aid[i].checked==true){
			array_aid.push(del_aid[i].value);
		}
	}
	$.ajax({
    	url: 'attribute.manage.php?action=del',
    	type: 'post',
    	dataType: 'html',
		data: 'txtAid=' + array_aid,
    	timeout: 1000,
    	error: function(){
        	alert('something wrong');
    	},
    	success: function(html){
			//alert(html);
			//if(html == "ok"){
				window.location.reload();
			//}
        }
	});
}
/*
 * 调用div对话窗口
 * 管理属性内容
 */
function manage_ac(aid,aname)   
{
	$.ajax({
    	url: 'attribute_content.manage.php?action=list',
    	type: 'post',
    	dataType: 'html',
		data: 'aname=' + aname +'&aid=' + aid,
		timeout: 1000,
    	error: function(){
        	alert('something wrong');
    	},
    	success: function(html){
			//alert(msg);
				document.getElementById('contentDIV').innerHTML=html;
				var showData = document.getElementById('contentDIV').innerHTML;
				ScreenConvert();DialogShow(showData,500,400,520,420);
				
        }
	});
	
 //PostRequest(window.location.protocol + "//" + window.location.host + "/ajax_Comm.aspx", PostData);   
 //$('#contentDIV').html('123');
 //ScreenConvert();DialogShow("<div id=\"DialogLoading\">正在读取,请稍候...</div>",110,10,124,20);   
}

/*
 * 添加属性内容
 */
function add_ac()
{
	var uaid = document.getElementById('txtaddAid').value;
	var uaccontent = document.getElementById('txtaddACcontent').value;
	var uacorder = document.getElementById('txtaddACorder').value;
	var uaname = document.getElementById('txtaddAname').value;
	//alert(uaccontent);
	$.ajax({
    	url: 'attribute_content.manage.php?action=add',
    	type: 'post',
    	dataType: 'html',
		data: 'accontent=' + uaccontent +'&acorder=' + uacorder + '&aid=' + uaid,
		timeout: 1000,
    	error: function(){
        	alert('something wrong');
    	},
    	success: function(){
			//alert(msg);
			manage_ac(uaid, uaname);
		}
	});
}

/*
 * 编辑属性内容
 */
function update_ac(acid)
{
	var uaid = document.getElementById('txtaddAid').value;
	var uaccontent = document.getElementById('txtupdateACcontent' + acid).value;
	var uacorder = document.getElementById('txtupdateACorder' + acid).value;
	var uaname = document.getElementById('txtaddAname').value;
	//alert(uaccontent);
	$.ajax({
    	url: 'attribute_content.manage.php?action=update',
    	type: 'post',
    	dataType: 'html',
		data: 'accontent=' + uaccontent +'&acorder=' + uacorder + '&acid=' + acid,
		timeout: 1000,
    	error: function(){
        	alert('something wrong');
    	},
    	success: function(){
			//alert(msg);
			manage_ac(uaid, uaname);
		}
	});
}

/*
 * 删除属性内容
 */
function del_ac()
{
	var uaid = document.getElementById('txtaddAid').value;
	var uaname = document.getElementById('txtaddAname').value;
	var delacid = document.getElementsByName('txtupdateAcid');
	var array_aid = new Array();
	for(i=0;i<delacid.length;i++){
		if(delacid[i].checked==true){
			array_aid.push(delacid[i].value);
		}
	}
	//alert(uaccontent);
	$.ajax({
    	url: 'attribute_content.manage.php?action=del',
    	type: 'post',
    	dataType: 'html',
		data: 'acid=' + array_aid,
		timeout: 1000,
    	error: function(){
        	alert('something wrong');
    	},
    	success: function(){
			//alert(msg);
			manage_ac(uaid, uaname);
		}
	});
}